package com.ddyx.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ddyx.common.util.ResponseJson;
import com.ddyx.mapper.DealShowMapper;
import com.ddyx.service.IDealShowService;

/**
 * @ClassName: DealShowImpl.java
 * @Module: 门店交易记录逻辑实现模块
 * @Description: 
 * 
 * @author: QingGuan.Kong
 * @date: 2017年9月13日 上午10:13:10
 * 
 */
@Service("dealShowService")
public class DealShowImpl implements IDealShowService{

	@Resource
	DealShowMapper dealShowMapper;
	
	/**
	 * 查询门店交易记录
	 */
	@Override
	public String selectAll(int page, int size, String vipNo, String mobile, String billNo, String storeId) {
		int start = 0;
		if(size<1)
			size=20;//默认每页20条
		if(page<1)
			page = 1;//默认第1页
		start = (page-1)*size;
		int total = dealShowMapper.countDealShow(start, size, vipNo, mobile, billNo, storeId);
		if(total<1)
			return ResponseJson.getInstance().toString();
		List<Map<String,Object>> list = dealShowMapper.selectAll(start, size, vipNo, mobile, billNo, storeId);
		return ResponseJson.getInstance()
				.setPage(page).setSize(size).setTotal(total).setData(list).toString();
	}
}
